import time


async def testOrderDetails(browser):
    try:
        browser.find_element_by_xpath("//span[contains(text(),'销售管理')]").click()  # 点击导航
        time.sleep(0.5)

        menus = browser.find_elements_by_class_name('popover-menu')  # 所有菜单
        nowMenus = menus[len(menus) - 1]  # 获取最后一个菜单，点开的都回默认为最后一个
        # 点击第一排第三个
        nowMenus.find_elements_by_class_name('menu-prop__item')[0].find_elements_by_tag_name('a')[2].click()
        # browser.find_elements_by_xpath("//span[contains(text(),'单据表')]")[0].click()  # 点击菜单
        time.sleep(0.5)
        browser.find_element_by_xpath("//div[contains(text(),'订货明细列表')]").click()
        time.sleep(0.8)
        print(browser.find_elements_by_class_name('el-form-item__content'))
        queryButton = \
            browser.find_elements_by_class_name('el-form-item__content')[3].find_elements_by_tag_name('button')[
                0]  # 查询按钮
        searchBox = browser.find_element_by_xpath(
            "//label[contains(text(),'明细查询')]/following-sibling::div/div/input")  # 搜索框

        queryButton.click()
        time.sleep(0.2)
        searchBox.send_keys("1")  # 单据查看
        time.sleep(0.2)
        queryButton.click()
        searchBox.send_keys("1234")  # 单据查看
        time.sleep(0.5)
        queryButton.click()
    finally:
        print(browser.current_url, '完成')
        # browser.close()
